<template>
	<view class="p-4 bg-white">
		<mp-html :content="content" selectable class="text-wrap content"></mp-html>
	</view>
</template>

<script lang="ts" setup>
import { ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import { $page,$http } from '@/utils';
	const content=ref('');
  onLoad((options:any)=>{
    let url='Article/getContent';
    if(options.alias){
      url='Article/getContentByAlias';
    }
    $http.get(url,{
      data:{
        id:options.id,
        alias:options.alias
      }
    }).then((res:any)=>{
      if(res.code===$http.ResponseCode.SUCCESS){
        $page.title(res.data.title);
        content.value=res.data.content;
      }else{
        uni.showModal({
          title:'提示',
          content:res.msg,
          showCancel:false,
          success(){
            uni.navigateBack();
          }
        })
      }
    })
  })
</script>

<style lang="scss">
	.content ._img{
		max-width: 100%;
	}
</style>
